from openpyxl import load_workbook

"""
生成高德地图标点所用代码
"""

inFile = "C:\Download\Result_2.xlsx"

# 打开文件
originXlsx = load_workbook(inFile)
activeSheet = originXlsx["Result 1"]

# 获取N列和O列数据
colN = [item.value for item in activeSheet["N"]]
colO = [item.value for item in activeSheet["O"]]
colN = colN[1:]
colO = colO[1:]


for i in range(len(colN)):
    lon = colN[i]
    lat = colO[i]
    str = "{" + f"icon: '//a.amap.com/jsapi_demos/static/demo-center/icons/poi-marker-red.png',position: [{lon},{lat}]" + "},"
    print(str)